package WizardTD.element;

import WizardTD.App;
import WizardTD.constant.ImageConstant;
import lombok.Data;
import processing.core.PApplet;
import processing.core.PImage;

/**
 * @author HustleLr
 * @version 1.0.0
 */
@Data
public class DestroyMonster extends Element{

    private int status;
    private PImage pImage;
    private int count;


    public DestroyMonster (float x, float y, int status) {
        super(x, y);
        this.status = status;
    }

    @Override
    public void draw(PApplet pApplet) {
        switch (this.status) {
            case 1:
                pImage = ImageConstant.gremlin1;
                break;
            case 2:
                pImage = ImageConstant.gremlin2;
                break;
            case 3:
                pImage = ImageConstant.gremlin3;
                break;
            case 4:
                pImage = ImageConstant.gremlin4;
                break;
            case 5:
                pImage = ImageConstant.gremlin5;
                break;
            default:
                App.monsterBox.removeDestroyMonsters.add(this);
        }
        pApplet.image(pImage, this.getCoordinateX(), this.getCoordinateY());
        updateStatus(pApplet);
    }

    private void updateStatus(PApplet pApplet) {
        count++;
        if (count % 4 == 0) {
            status++;
        }
    }
}
